cmake_minimum_required(VERSION 3.8)
project(point_transfor)

# 默认使用C++17
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# 查找依赖
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(pcl_conversions REQUIRED)
find_package(PCL REQUIRED)
find_package(OpenCL REQUIRED)
#imu add
find_package(tf2 REQUIRED)
find_package(tf2_eigen REQUIRED)
find_package(Eigen3 REQUIRED)
#imu end
# 包含目录
include_directories(
  include
  ${PCL_INCLUDE_DIRS}
  ${OpenCL_INCLUDE_DIRS}
)

# 链接库目录
link_directories(
  ${PCL_LIBRARY_DIRS}
)

add_definitions(${PCL_DEFINITIONS})

# 生成可执行文件
add_executable(point_transfor src/pointcloud_transformer_node.cpp src/cl_process.cpp)

# 链接依赖库
ament_target_dependencies(point_transfor
  rclcpp
  sensor_msgs
  pcl_conversions
  tf2
  tf2_eigen
  Eigen3
)

target_link_libraries(point_transfor
  ${PCL_LIBRARIES}
  ${OpenCL_LIBRARIES}
)

# 安装可执行文件和启动文件
install(TARGETS
  point_transfor
  DESTINATION lib/${PROJECT_NAME})

install(DIRECTORY
  launch
  config
  DESTINATION share/${PROJECT_NAME}/
)

ament_package()
    
